package com.genexususa.eo.bing.test.add;

import com.genexususa.eo.bing.connection.SitePlacementManager;
import com.genexususa.eo.bing.test.TestUtil;

public class ConsumeAddSitePlacements {
    public static void main(String[] args) {
        TestUtil testUtil = new TestUtil();
        String sitePlacementsRequestsXML =  "<Bing_SitePlacementsRequestCollection xmlns=\"L2TMediaDev\">\n" +
                                                "\t<Bing_SitePlacementsRequest xmlns=\"L2TMediaDev\">\n" +
                                                    "\t\t<GxCampaignId>45616011</GxCampaignId>\n" +
                                                    "\t\t<BingCampaignId>" + testUtil.campaignId1 +"</BingCampaignId>\n" +
                                                    "\t\t<SitePlacementsAdGroupRequestCollection>\n" +
                                                        "\t\t\t<SitePlacementsAdGroupRequest>\n" +
                                                            "\t\t\t\t<GxAdGroupId>452315612</GxAdGroupId>\n" +
                                                            "\t\t\t\t<BingAdGroupId>" + testUtil.adGroup11 + "</BingAdGroupId>\n" +
                                                            "\t\t\t\t<SitePlacementCollection>\n" +
                                                                "\t\t\t\t\t<SitePlacement>\n" +
                                                                    "\t\t\t\t\t\t<Bid xmlns=\"https://adcenter.microsoft.com/v8\">\n" +
                                                                        "\t\t\t\t\t\t\t<Amount>500.00</Amount>\n" +
                                                                    "\t\t\t\t\t\t</Bid>\n" +
                                                                    "\t\t\t\t\t\t<GxSitePlacementId xmlns=\"https://adcenter.microsoft.com/v8\">640894056122</GxSitePlacementId>\n" +
                                                                    "\t\t\t\t\t\t<PlacementId xmlns=\"https://adcenter.microsoft.com/v8\">5379774</PlacementId>\n" +
                                                                    "\t\t\t\t\t\t<Url xmlns=\"https://adcenter.microsoft.com/v8\">www.gmail.com</Url>\n" +
                                                                "\t\t\t\t\t</SitePlacement>\n" +
                                                                "\t\t\t\t\t<SitePlacement>\n" +
                                                                    "\t\t\t\t\t\t<Bid xmlns=\"https://adcenter.microsoft.com/v8\">\n" +
                                                                        "\t\t\t\t\t\t\t<Amount>135.00</Amount>\n" +
                                                                    "\t\t\t\t\t\t</Bid>\n" +
                                                                    "\t\t\t\t\t\t<GxSitePlacementId xmlns=\"https://adcenter.microsoft.com/v8\">640894056123</GxSitePlacementId>\n" +
                                                                    "\t\t\t\t\t\t<PlacementId xmlns=\"https://adcenter.microsoft.com/v8\">4603062</PlacementId>\n" +
                                                                    "\t\t\t\t\t\t<Url xmlns=\"https://adcenter.microsoft.com/v8\">www.bing.com</Url>\n" +
                                                                "\t\t\t\t\t</SitePlacement>\n" +
                                                            "\t\t\t\t</SitePlacementCollection>\n" +
                                                        "\t\t\t</SitePlacementsAdGroupRequest>\n" +
                                                    "\t\t</SitePlacementsAdGroupRequestCollection>\n" +
                                                "\t</Bing_SitePlacementsRequest>\n" +
                                                "\t<Bing_SitePlacementsRequest xmlns=\"L2TMediaDev\">\n" +
                                                    "\t\t<GxCampaignId>45616012</GxCampaignId>\n" +
                                                    "\t\t<BingCampaignId>" + testUtil.campaignId2 +"</BingCampaignId>\n" +
                                                    "\t\t<SitePlacementsAdGroupRequestCollection>\n" +
                                                        "\t\t\t<SitePlacementsAdGroupRequest>\n" +
                                                            "\t\t\t\t<GxAdGroupId>452315613</GxAdGroupId>\n" +
                                                            "\t\t\t\t<BingAdGroupId>" + testUtil.adGroup21 + "</BingAdGroupId>\n" +
                                                            "\t\t\t\t<SitePlacementCollection>\n" +
                                                                "\t\t\t\t\t<SitePlacement>\n" +
                                                                "\t\t\t\t\t\t<Bid xmlns=\"https://adcenter.microsoft.com/v8\">\n" +
                                                                    "\t\t\t\t\t\t\t<Amount>156.00</Amount>\n" +
                                                                "\t\t\t\t\t\t</Bid>\n" +
                                                                "\t\t\t\t\t\t<GxSitePlacementId xmlns=\"https://adcenter.microsoft.com/v8\">640894056124</GxSitePlacementId>\n" +
                                                                "\t\t\t\t\t\t<PlacementId xmlns=\"https://adcenter.microsoft.com/v8\">5703222</PlacementId>\n" +
                                                                "\t\t\t\t\t\t<Url xmlns=\"https://adcenter.microsoft.com/v8\">www.yahoo.com</Url>\n" +
                                                            "\t\t\t\t\t</SitePlacement>\n" +
                                                            "\t\t\t\t</SitePlacementCollection>\n" +
                                                        "\t\t\t</SitePlacementsAdGroupRequest>\n" +
                                                        "\t\t\t<SitePlacementsAdGroupRequest>\n" +
                                                            "\t\t\t\t<GxAdGroupId>452315614</GxAdGroupId>\n" +
                                                            "\t\t\t\t<BingAdGroupId>" + testUtil.adGroup22 + "</BingAdGroupId>\n" +
                                                            "\t\t\t\t<SitePlacementCollection>\n" +
                                                                "\t\t\t\t\t<SitePlacement>\n" +
                                                                    "\t\t\t\t\t\t<Bid xmlns=\"https://adcenter.microsoft.com/v8\">\n" +
                                                                        "\t\t\t\t\t\t\t<Amount>363.00</Amount>\n" +
                                                                    "\t\t\t\t\t\t</Bid>\n" +
                                                                    "\t\t\t\t\t\t<GxSitePlacementId xmlns=\"https://adcenter.microsoft.com/v8\">640894056125</GxSitePlacementId>\n" +
                                                                    "\t\t\t\t\t\t<PlacementId xmlns=\"https://adcenter.microsoft.com/v8\">613273</PlacementId>\n" +
                                                                    "\t\t\t\t\t\t<Url xmlns=\"https://adcenter.microsoft.com/v8\">www.google.com</Url>\n" +
                                                                "\t\t\t\t\t</SitePlacement>\n" +
                                                            "\t\t\t\t</SitePlacementCollection>\n" +
                                                        "\t\t\t</SitePlacementsAdGroupRequest>\n" +
                                                    "\t\t</SitePlacementsAdGroupRequestCollection>\n" +
                                                "\t</Bing_SitePlacementsRequest>\n" +
                                            "</Bing_SitePlacementsRequestCollection>\n";
        SitePlacementManager resource = new SitePlacementManager();
        System.out.println("Consuming AddSitePlacements.....");
        String userName = testUtil.userName;
        String password = testUtil.password;
        String developerToken = testUtil.developerToken;
        long customerId = testUtil.customerId;
        long customerAccountId = testUtil.customerAccountId;
        String applicationId = testUtil.applicationId;
        //String result = resource.addSitePlacements(userName, password, developerToken, customerId, customerAccountId, applicationId, sitePlacementsRequestsXML);
        String result = resource.addSitePlacements(customerAccountId, sitePlacementsRequestsXML);
        System.out.println("Result:\n" + result);
    }
}
